package org.rambadger.command.resource;


import com.yammer.dropwizard.auth.Auth;
import com.yammer.dropwizard.views.View;
import org.rambadger.command.auth.AuthUser;
import org.rambadger.command.view.IndexView;
import org.rambadger.command.view.LoginView;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/")
@Produces({MediaType.TEXT_HTML})
public class IndexResource {
    @GET
    public View Index(@Auth(required = false) AuthUser user){
        if (user == null)
            return new LoginView();
        else
            return new IndexView(user);
    }

}
